---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [9], in <cell line: 1>()
----> 1 BOBO_FET.visualize_loss()
File /gpfs/loomis/project/krishnaswamy_smita/kjm76/directed_graphs/directed_graphs/flow_embedding_training_utils.py:133, in FETrainer.visualize_loss(self, loss_type)
131 if loss_type == "all":
132 for key in self.losses.keys():
--> 133 plt.plot(self.losses[key])
134 plt.legend(self.losses.keys(), loc='upper right')
135 plt.title("loss")
File /gpfs/loomis/project/krishnaswamy_smita/kjm76/conda_envs/flowembed/lib/python3.9/site-packages/matplotlib/pyplot.py:2769, in plot(scalex, scaley, data, *args, **kwargs)
2767 @_copy_docstring_and_deprecators(Axes.plot)
2768 def plot(*args, scalex=True, scaley=True, data=None, **kwargs):
-> 2769 return gca().plot(
2770 *args, scalex=scalex, scaley=scaley,
2771 **({"data": data} if data is not None else {}), **kwargs)
File /gpfs/loomis/project/krishnaswamy_smita/kjm76/conda_envs/flowembed/lib/python3.9/site-packages/matplotlib/axes/_axes.py:1632, in Axes.plot(self, scalex, scaley, data, *args, **kwargs)
1390 """
1391 Plot y versus x as lines and/or markers.
1392
(...)
1629 (``'green'``) or hex strings (``'#008000'``).
1630 """
1631 kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> 1632 lines = [*self._get_lines(*args, data=data, **kwargs)]
1633 for line in lines:
1634 self.add_line(line)
File /gpfs/loomis/project/krishnaswamy_smita/kjm76/conda_envs/flowembed/lib/python3.9/site-packages/matplotlib/axes/_base.py:312, in _process_plot_var_args.__call__(self, data, *args, **kwargs)
310 this += args[0],
311 args = args[1:]
--> 312 yield from self._plot_args(this, kwargs)
File /gpfs/loomis/project/krishnaswamy_smita/kjm76/conda_envs/flowembed/lib/python3.9/site-packages/matplotlib/axes/_base.py:490, in _process_plot_var_args._plot_args(self, tup, kwargs, return_kwargs)
488 y = _check_1d(xy[1])
489 else:
--> 490 x, y = index_of(xy[-1])
492 if self.axes.xaxis is not None:
493 self.axes.xaxis.update_units(x)
File /gpfs/loomis/project/krishnaswamy_smita/kjm76/conda_envs/flowembed/lib/python3.9/site-packages/matplotlib/cbook/__init__.py:1614, in index_of(y)
1612 pass
1613 try:
-> 1614 y = _check_1d(y)
1615 except (np.VisibleDeprecationWarning, ValueError):
1616 # NumPy 1.19 will warn on ragged input, and we can't actually use it.
1617 pass
File /gpfs/loomis/project/krishnaswamy_smita/kjm76/conda_envs/flowembed/lib/python3.9/site-packages/matplotlib/cbook/__init__.py:1306, in _check_1d(x)
1304 x = _unpack_to_numpy(x)
1305 if not hasattr(x, 'shape') or len(x.shape) < 1:
-> 1306 return np.atleast_1d(x)
1307 else:
1308 return x
File <__array_function__ internals>:180, in atleast_1d(*args, **kwargs)
File /gpfs/loomis/project/krishnaswamy_smita/kjm76/conda_envs/flowembed/lib/python3.9/site-packages/numpy/core/shape_base.py:65, in atleast_1d(*arys)
63 res = []
64 for ary in arys:
---> 65 ary = asanyarray(ary)
66 if ary.ndim == 0:
67 result = ary.reshape(1)
File /gpfs/loomis/project/krishnaswamy_smita/kjm76/conda_envs/flowembed/lib/python3.9/site-packages/torch/_tensor.py:757, in Tensor.__array__(self, dtype)
755 return handle_torch_function(Tensor.__array__, (self,), self, dtype=dtype)
756 if dtype is None:
--> 757 return self.numpy()
758 else:
759 return self.numpy().astype(dtype, copy=False)
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.